package com.skrabacz.kinetic.buisness.logic;

import static org.junit.Assert.*;

import org.junit.Test;

public class NodeShould {

	private final static double PRECISION = 0.0000001;

	@Test
	public void setZeroAsADefaultPointValue() throws Exception {
		assertEquals(0, new Node().getValue(), PRECISION);
	}

	@Test
	public void returnValueSettedInConstructor() throws Exception {
		assertEquals(2.3d, new Node(2.3d).getValue(), PRECISION);
	}

	@Test
	public void beAbleToCompareWithAnotherNode() throws Exception {
		assertEquals(new Node(1d), new Node(1d));
	}

	@Test
	public void beAbleToPointBetterNode() throws Exception {
		assertEquals(0, new Node(1d).compareTo(new Node(1d)));
		assertEquals(1, new Node(2d).compareTo(new Node(1d)));
		assertEquals(-1, new Node(1d).compareTo(new Node(2d)));
	}

	@Test
	public void beAbleReturnCoordination() throws Exception {
		assertNotNull(new Node().getCoordinates());
	}

	@Test
	public void beAbleReturnCoordinationInSimpleFormat() throws Exception {
		assertTrue(new Node().getCoordinateX() == 0l);
		assertTrue(new Node().getCoordinateY() == 0l);
	}

}
